package com.butterfly.hotkey.core.model;

/**
 * 所有key缓存的时间
 *
 * @author butterfly
 */
public class AppCacheModel {

    /**
     * 初始化
     */
    private int initialCapacity;

    /**
     * 最大缓存时间
     */
    private long maximumSize;

    public int getInitialCapacity() {
        return initialCapacity;
    }

    public void setInitialCapacity(int initialCapacity) {
        this.initialCapacity = initialCapacity;
    }

    public long getMaximumSize() {
        return maximumSize;
    }

    public void setMaximumSize(long maximumSize) {
        this.maximumSize = maximumSize;
    }

    public static final class Builder {
        private int initialCapacity;
        private long maximumSize;

        private Builder() {
        }

        public static Builder builder() {
            return new Builder();
        }

        public Builder initialCapacity(int initialCapacity) {
            this.initialCapacity = initialCapacity;
            return this;
        }

        public Builder maximumSize(long maximumSize) {
            this.maximumSize = maximumSize;
            return this;
        }

        public AppCacheModel build() {
            AppCacheModel appCacheModel = new AppCacheModel();
            appCacheModel.setInitialCapacity(initialCapacity);
            appCacheModel.setMaximumSize(maximumSize);
            return appCacheModel;
        }
    }
}